package com.buer.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class IndexController {
    /**
     * 日志工具
     */
    private static Logger LOG = LoggerFactory.getLogger(IndexController.class);

    @RequestMapping(value = {"/index", "/"})
    public void index(HttpServletRequest request, HttpServletResponse response) {
        try {
//            ModelAndView mv = new ModelAndView("index.ftl");
//            return mv;
            response.sendRedirect("/preLoadingRate.htm");
        } catch (Exception e) {
            LOG.error("进入主页异常，e={}", e);
            ModelAndView mv = new ModelAndView("error.ftl");
            mv.addObject("activeIndex", "1");
            mv.addObject("activeName", "1");
//            return mv;
        }
    }
}
